package net.xiangcaowuyu.activemqdemo.service;

import lombok.extern.slf4j.Slf4j;
import net.xiangcaowuyu.activemqdemo.constants.Constants;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * 博客：https://www.xiangcaowuyu.net
 * Description:
 *
 * @Author: 香草物语
 * DateTime: 2021-07-20 14:44
 */
@Component
@Slf4j
public class Consumer {

    @JmsListener(destination = Constants.QUEUEMESSAGE)
    public void receiveQueueMessage1(String message) {
        if (null != message) {
            log.info("收到queue报文1：" + message);
        }
    }

    @JmsListener(destination = Constants.QUEUEMESSAGE)
    public void receiveQueueMessage2(String message) {
        if (null != message) {
            log.info("收到queue报文2：" + message);
        }
    }

    @JmsListener(destination = Constants.TOPICMESSAGE)
    public void receiveTopicMessage1(String message) {
        if (null != message) {
            log.info("收到topic报文1：" + message);
        }
    }

    @JmsListener(destination = Constants.TOPICMESSAGE)
    public void receiveTopicMessage2(String message) {
        if (null != message) {
            log.info("收到topic报文2：" + message);
        }
    }

}
